#pragma once
#define GLEW_STATIC
#include <libglew/glew.h>
#ifdef WIN32
#include <GL/glut.h>
#endif
#ifdef __APPLE__
#include <GLUT/glut.h>
#endif
#include <vector>
#include "Camera.h"
#include "DrawableObject.h"
#include "SelectableObject.h"
#include "SkyBox.h"
#include "PointLightSource.h"
#include "SpotLightSource.h"
#include "GLSLShader.h"
#include "HUDElement.h"

namespace lib3dw
{
	class Scene
	{
		public:
			Scene(Camera* newCamera);
			~Scene();
			
			void Draw();
			void DrawGeometry();
			void AddObject(DrawableObject* object);
			void RemoveObject(DrawableObject* object);
			void AddLight(LightSource* light);
			void AddHUDElement(HUDElement* element);
			SelectableObject* GetObjectUnderMouse(PickRay* newPickRay);
			static void StaticWrapperToCallDrawGeometry();

		private:
			std::list<DrawableObject*> drawableObjects; 
			std::list<DrawableObject*>::const_iterator drawableObjectIterator;
			std::vector<SelectableObject*> selectableObjects; 
			std::vector<SelectableObject*>::const_iterator selectableObjectIterator;
			std::vector<LightSource*> lights; 
			std::vector<LightSource*>::const_iterator lightIterator;
			std::vector<HUDElement*> hudElements; 
			std::vector<HUDElement*>::const_iterator hudElementIterator;
			
			GLSLShaderProgram* finalShader;
			Camera* camera;
			SkyBox* skybox;
			PickRay* pickRay;
			SelectableObject* objectUnderMouse;
	};
}